package com.antler.luajavalibrary.luajava;

public class LuaJava {

    static {
        System.loadLibrary("luajava");
    }

    // Interface
    public static void openLibs() {
        nativeOpenLibs();
    }

    public static void closeLibs() {
        nativeCloseLibs();
    }

    public static void setPackagePath(String path) {
        nativeSetPackagePath(path);
    }

    public static void setPackageCPath(String cpath) {
        nativeSetPackageCPath(cpath);
    }

    public static void setCallback(Object cb) {
        nativeSetCallback(cb);
    }

    public static int doFile(String filePath) throws Exception {
        return nativeDoFile(filePath);
    }

    public static int doString(String str) throws Exception {
        return nativeDoString(str);
    }

    public static void doStop() {
        nativeDoStop();
    }

    public static void sendEvent(String id, int action, int funID) {
        nativeSendEvent(id, action, funID);
    }

    public static void removeActionCallback(int action, int funID) {
        nativeRemoveActionCallback(action, funID);
    }

    // Native Interface
    private static native void nativeOpenLibs();

    private static native void nativeCloseLibs();

    private static native void nativeSetPackagePath(String path);

    private static native void nativeSetPackageCPath(String cpath);

    private static native void nativeSetCallback(Object cb);

    private static native int nativeDoFile(String filePath) throws Exception;

    private static native int nativeDoString(String str) throws Exception;

    private static native void nativeDoStop();

    private static native void nativeSendEvent(String id, int action, int funID);

    private static native void nativeRemoveActionCallback(int action, int funID);
}
